﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.ComponentModelHost;

namespace Util
{
    [Export]
    public class HistoryRegistryUtil
    {
        private static Lazy<HistoryRegistryUtil> instance = new Lazy<HistoryRegistryUtil>();
        private static HistoryRegistryUtil Instance { get { return instance.Value; } }

        [Import]
        ITextUndoHistoryRegistry registry = null;

        public HistoryRegistryUtil()
        {
            
            VSUtil.GetComponentModel().DefaultCompositionService.SatisfyImportsOnce(this);
        }

        public ITextUndoHistoryRegistry UndoHistoryRegistryLocal
        {
            get { return registry; }
        }

        public static ITextUndoHistoryRegistry UndoHistoryRegistry
        {
            get { return Instance.UndoHistoryRegistryLocal; }
        }
    }
}
